home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
misc
/
frefs11.lha
/
FetchRefs
/
Rexx
/
GoFetchRefs.ttx
< prev
Wrap
Text File
|
1994-10-28
|
2KB
|
93 lines
/* $VER: GoFetchRexx.ttx 1.1 (28.10.94)
**
** ARexx script to invoke FetchRefs from TurboText.
*/
OPTIONS RESULTS
caller = ADDRESS()
/* Static part of the editor's ARexx port name. That is, the name before any
* suffixes (like '.1') are appended.
*/
editorname = 'TURBOTEXT'
/* Exit if we're not called from the editor */
IF (LEFT(caller, LENGTH(editorname)) ~= editorname) then
EXIT 10
/* Get the current word from the editor, reading char by char */
'SetDisplayLock ON'
position = 0
function = ''
'GetChar'
char = result
DO WHILE VERIFY(char, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_#?") = 0
function = function || char
'MoveRight'
position = position + 1
'GetChar'
char = result
END
'MoveLeft' position
'SetDisplayLock OFF'
/* Define a temporary filename to put the reference into */
cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_")
if cutat > 0 THEN
basename = LEFT(function, cutat - 1)
ELSE
basename = function
filename = 'T:FR_'basename
/* It doesn't matter whether we want a taglist, varargs og whatever function */
IF RIGHT(function, 7) = "TagList" THEN
function = LEFT(function, LENGTH(function) - 7)
ELSE IF RIGHT(function, 4) = "Tags" THEN
function = LEFT(function, LENGTH(function) - 4)
ELSE IF RIGHT(function, 1) = "A" THEN
function = LEFT(function, LENGTH(function) - 1)
/* Now actually get the reference */
ADDRESS 'FETCHREFS'
FR_GET function || '(%|Tags|TagList|A)' filename CASE FILEREF
gotoline = rc2
/* Address editor again to load the file or report error */
ADDRESS VALUE caller
IF rc ~= 0 THEN DO
/* Skip if the error was '...!' (actually 'Aborted!'). This occours
* whenever the 'select from what file' window is closed, which is
* not really an error.
*/
IF RIGHT(rc2, 1) = '!' THEN
EXIT 0
/* Report the error (obtained from FetchRefs) in the editor. */
'SetStatusBar Temporary' rc2
EXIT 0
END
ELSE DO
/* Make the editor open a new window and load the autodoc into it. */
'OpenDoc NAME' filename
docPort = result
ADDRESS VALUE docPort
'SetDisplayLock ON'
/* Jump to the suggested line */
IF gotoline ~= 0 THEN
'Move FOLDS' gotoline
'SetDisplayLock OFF'
/* Delete the temporary file */
ADDRESS COMMAND 'C:Delete >NIL:' filename
EXIT 0
END